package com.hh.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hh.demo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 吉吉国王
 * @since 2022-07-11
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    //查询全部卡号
    @Select("select `userCard` from user")
    List<User> queryAllUser();
    //根据卡号查到借阅人
    @Select("select `userName` from user where userCard=#{userCard}")
    String queryUser(String userCard);
    @Insert("insert into `user`(`userName`,`sex`,`age`,`grade`,`userCard`) values (#{userName},#{sex},#{age},#{grade},#{userCard})")
    void insertUser(String userName, String sex, Integer age, String grade, String userCard);
}
